Bỏ qua để đến nội dung

Meet the Canvas

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

Our engine renders effects in realtime using the html canvas element, similar to the way a browser renders websites you visit.

Custom effects must be stored in a specific folder in your computer so we can find them. Regardless of which IDE you choose, each effect is a single HTML file that belongs in C:\Users\<username>\AppData\Local\VortxEngine\app-<version>\Signal-x64\Effects\Dynamic\ while in development, they are shown at the “Installed” menu, for every new file put in said folder, SignalRGB needs to be restarted.

The <canvas> must be created in your <body> element and then correctly fetched in the <script> (represented in this example by var ctx). Methods attached to ctx such as fillStyle, fillRect, etc. can then be used to create the desired animations. A simple hue cycle example follows.

<head>
<title>Hue Cycle</title>
<meta description="Stock hue cycle."/>
<meta publisher="WhirlwindFX" />
<meta property="speed" label="Cycle Speed" type="number" min="1" max="10" default="2">
</head>
<body style="margin: 0; padding: 0;">
<canvas id="exCanvas" width="320" height="200"></canvas>
</body>
<script>
// Get the canvas element from the DOM
var c = document.getElementById("exCanvas");
var ctx = c.getContext("2d");
var width = 320;
var height = 200;
var hue = 0;
function update()
{
ctx.fillStyle = 'hsl('+ hue + ', 100%, 50%)';
ctx.fillRect(0, 0, width , height);
hue+=(speed / 4);
if (hue > 360) { hue = hue % 360; }
window.requestAnimationFrame(update);
}
window.requestAnimationFrame(update);
</script>
<head>
<title>Hue Cycle</title>
<meta description="Stock hue cycle."/>
<meta publisher="WhirlwindFX" />
<meta property="speed" label="Cycle Speed" type="number" min="1" max="10" default="2">
</head>
<body style="margin: 0; padding: 0;">
<canvas id="exCanvas" width="320" height="200"></canvas>
</body>
<script>
// Get the canvas element from the DOM
var c = document.getElementById("exCanvas");
var ctx = c.getContext("2d");
var width = 320;
var height = 200;
var hue = 0;
function update()
{
ctx.fillStyle = 'hsl('+ hue + ', 100%, 50%)';
ctx.fillRect(0, 0, width , height);
hue+=(speed / 4);
if (hue > 360) { hue = hue % 360; }
window.requestAnimationFrame(update);
}
window.requestAnimationFrame(update);
</script>

And there we have it, a very impressive hue cycle. It might be basic, but this little template contains everything you need to get started coding! For more detail, check out Effects Are Webpages.