Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fadecandy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scanlime
Fadecandy
Commits
c7c0764b
Commit
c7c0764b
authored
11 years ago
by
supsup
Browse files
Options
Downloads
Patches
Plain Diff
Update random-color-pixel-strip.html
parent
adb3063e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/html/random-color-pixel-strip.html
+9
-8
9 additions, 8 deletions
examples/html/random-color-pixel-strip.html
with
9 additions
and
8 deletions
examples/html/random-color-pixel-strip.html
+
9
−
8
View file @
c7c0764b
...
@@ -57,7 +57,10 @@
...
@@ -57,7 +57,10 @@
}
}
// Set Default Black Color.
// Set Default Black Color.
var
color
=
{
r
:
0
,
b
:
0
,
g
:
0
};
var
defaultColor
=
{
r
:
0
,
b
:
0
,
g
:
0
};
// Set Queue Speed, default is 3 seconds.
var
speed
=
3000
;
// Set all pixels to a given color
// Set all pixels to a given color
function
writeFrame
(
red
,
green
,
blue
)
{
function
writeFrame
(
red
,
green
,
blue
)
{
...
@@ -91,7 +94,7 @@
...
@@ -91,7 +94,7 @@
for
(
var
led
=
0
;
led
<
leds
;
led
++
)
{
for
(
var
led
=
0
;
led
<
leds
;
led
++
)
{
//protection against null from random color.
//protection against null from random color.
myObj
===
null
?
myObj
=
{
r
:
0
,
b
:
0
,
g
:
0
}
:
myObj
;
myObj
===
null
?
myObj
=
defaultColor
:
myObj
;
packet
[
dest
++
]
=
myObj
.
r
;
packet
[
dest
++
]
=
myObj
.
r
;
packet
[
dest
++
]
=
myObj
.
g
;
packet
[
dest
++
]
=
myObj
.
g
;
...
@@ -107,14 +110,12 @@
...
@@ -107,14 +110,12 @@
// Animation loop
// Animation loop
var
animate
=
function
()
{
var
animate
=
function
()
{
// Get time delta
writeFrame
(
writeFrame
(
c
olor
.
r
,
defaultC
olor
.
r
,
c
olor
.
g
,
defaultC
olor
.
g
,
c
olor
.
b
);
defaultC
olor
.
b
);
setTimeout
(
animate
,
3000
);
setTimeout
(
animate
,
speed
);
}
}
// Connect to a Fadecandy server running on the same computer, on the default port
// Connect to a Fadecandy server running on the same computer, on the default port
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment