Get started with photon CDN

MIT licensed

Photon JS: Real-time communication, low-latency data transfer for web, mobile apps.

Tags:
  • photon
  • html
  • css
  • electron

Stable version

Copied!

How to start using photon CDN


<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://cdn.cdnhub.io/photon/0.1.2-alpha/css/photon.min.css">
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/photon.min.js"></script>
  <script>
    // Initialize Photon with default options
    photon.light('body', {
      color: '#ffffff',
      intensity: 1.0,
      ambient: 0.2,
      shadow: true,
      width: 100,
      height: 100,
      power: 2.0
    });

    // Add an event listener for a button click to change the light color
    document.querySelector('button').addEventListener('click', () => {
      photon.set('body', { color: '#ff0000' });
    });
  </script>
  <style>
    button {
      padding: 10px;
      cursor: pointer;
    }
  </style>
</head>
<body>
  <button>Change light color to red</button>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions