Skip to content
This repository has been archived by the owner on Apr 28, 2021. It is now read-only.

Color of an object changing in time #251

Closed
eunjongkim opened this issue Apr 18, 2018 · 3 comments
Closed

Color of an object changing in time #251

eunjongkim opened this issue Apr 18, 2018 · 3 comments

Comments

@eunjongkim
Copy link

Hi,

I'm trying to generate a sphere at a fixed position, whose color is changing in time (color at time t converted to a number specified by a function f(t), which is converted to a color by "RdBu" cmap)
Unfortunately, I wasn't able to find good examples to learn how to do this.

Is there any simple way to do this?
Thanks in advance.

@eunjongkim
Copy link
Author

@SimonDanisch
I think what I need is the code for generating video that appears on this link (from time 6:05, cats changing color in time red and blue):
https://www.youtube.com/watch?v=hdCURYg05jE

That would be sufficient to see what I need.

@SimonDanisch
Copy link
Member

Does this work for you?:

using GLVisualize, Colors, GeometryTypes

w = glscreen()
time = bounce(linspace(0, 1, 100))
color = map(time) do t
    RGBA{Float32}(t, 1-t, 0, 1)
end
s = Sphere(Point3f0(0), 1f0)
mesh = GLNormalMesh(s)
_view(visualize(mesh, color = color))
@async renderloop(w)

Sorry the API is still awfull.. I promise to soon release Makie.jl with a much better API & documentation!

@eunjongkim
Copy link
Author

Thanks. It works fine :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants