Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gl-react-native-v2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ym
gl-react-native-v2
Commits
b3abf3a1
Commit
b3abf3a1
authored
Jan 16, 2016
by
Gaëtan Renaudeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate AnimatedHelloGL to use Animated value
parent
3efbab54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
Examples/AdvancedEffects/src/Banner.js
Examples/AdvancedEffects/src/Banner.js
+1
-1
Examples/Simple/src/AnimatedHelloGL.js
Examples/Simple/src/AnimatedHelloGL.js
+7
-11
No files found.
Examples/AdvancedEffects/src/Banner.js
View file @
b3abf3a1
...
...
@@ -30,7 +30,7 @@ class Banner extends React.Component {
return
<
Surface
width
=
{
width
}
height
=
{
height
}
opaque
=
{
false
}
onLoad
=
{()
=>
console
.
log
(
"
Banner onLoad
"
)}
onProgress
=
{
e
=>
console
.
log
(
"
Banner onProgress
"
,
e
.
nativeEvent
)}
>
<
GL
.
Node
shader
=
{
shaders
.
banner
}
uniforms
=
{{
time
:
time
}}
/
>
<
GL
.
Node
shader
=
{
shaders
.
banner
}
uniforms
=
{{
time
}}
/
>
<
/Surface>
;
}
}
...
...
Examples/Simple/src/AnimatedHelloGL.js
View file @
b3abf3a1
const
React
=
require
(
"
react-native
"
);
const
GL
=
require
(
"
gl-react
"
);
const
{
Surface
}
=
require
(
"
gl-react-native
"
);
const
{
Animated
}
=
React
;
const
shaders
=
GL
.
Shaders
.
create
({
helloGL
:
{
...
...
@@ -21,20 +22,15 @@ class HelloGL extends React.Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
value
:
0
value
:
new
Animated
.
Value
(
0
)
};
}
componentDidMount
()
{
const
loop
=
time
=>
{
this
.
raf
=
requestAnimationFrame
(
loop
);
this
.
setState
({
value
:
(
1
+
Math
.
cos
(
time
/
1000
))
/
2
// cycle between 0 and 1
});
};
this
.
raf
=
requestAnimationFrame
(
loop
);
}
componentWillUnmount
()
{
cancelAnimationFrame
(
this
.
raf
);
const
loop
=
()
=>
Animated
.
sequence
([
Animated
.
timing
(
this
.
state
.
value
,
{
toValue
:
1
,
duration
:
1000
}),
Animated
.
timing
(
this
.
state
.
value
,
{
toValue
:
0
,
duration
:
1000
})
]).
start
(
loop
);
loop
();
}
render
()
{
const
{
width
,
height
}
=
this
.
props
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment