Browse Search Popular Register Upload Rules User list Login:
Search:
video by texture2

Image:
screenshot of the scene

Author: DrBalk

Group: Educational

Filesize: 0.5 MB

Date added: 2015-12-31

Rating: 6.4

Downloads: 1705

Views: 625

Comments: 5

Ratings: 4

Times favored: 0

Made with: Algodoo v2.1.0

Tags:
video,
texture,
movie,
torus,
schule

Scene tag

Using textures and Kilinichs (thanks!!) trick for case-structure in thyme,
you can manage now to display a video of a sequence of
seperated pictures as texture on a rectangle.
Here, the png format helps additionally, cause it has a transparency
channel. I am amazed how fast Algodoo can handle these textures.
You can even resize the rectangle and the video is automatically
resized with it. You can even cut objects and still keep the movie-texture!
In the left part of the scene you can see my first
tries with crocodiles, source is given as link. The animated torus i made
myself and its pictues can be used by you for your own convenience.
Last edited at 2015/12/31 14:43:50 by DrBalk
Please log in to rate this scene
edit
Similar scenes
Title: video by texture
Rating: 5
Filesize: 126.77 kB
Downloads: 333
Comments: 4
Ratings: 1
Date added: 2015/12/31 00:05:11
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Saw Trap: Mausoleum
Rating: 5
Filesize: 57.81 kB
Downloads: 1600
Comments: 1
Ratings: 1
Date added: 2010/10/08 00:10:47
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Platform Survival II (Can be used)
Rating: 5
Filesize: 40.38 kB
Downloads: 2753
Comments: 0
Ratings: 1
Date added: 2022/08/04 07:25:55
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Recorder & Video Player
Rating: 5.625
Filesize: 27.03 kB
Downloads: 1126
Comments: 4
Ratings: 2
Date added: 2016/07/06 08:30:42
Made with: Algodoo v2.1.0
Rating: rated 5.6
download
Title: Video player (FIX)
Rating: 5
Filesize: 456.15 kB
Downloads: 244
Comments: 1
Ratings: 3
Date added: 2008/10/05 04:14:22
Made with: Phun
Rating: rated 5
download
Title: this youtube new all this video :D
Rating: 4.7
Filesize: 3.58 MB
Downloads: 6389
Comments: 4
Ratings: 4
Date added: 2016/10/05 16:24:31
Made with: Algodoo v2.1.0
Rating: rated 4.7
download
Nice work! :tup:
:) thank you! There are so many things possible with it, same as with the "costumes" of the scratch-program, so a wide area of animations is opened by that trick.
The costume number is given by
cost := math.mod(math.toInt(10 * (sim.time)), 17);
as there should be 10 pictures per second and 17 frames from frame0 to frame16. And then comes the selection
where the texture is set to the correct frame, quite
much code, for each texture one line...

s_noonan gave me now the following hints:
___________________________________________­__________
the following alternate code also works:

cost := math.toInt((10 * (sim.time)) % 17);
texture = ["frame_00000.png", "frame_00001.png", "frame_00002.png", "frame_00003.png", "frame_00004.png", "frame_00005.png", "frame_00006.png", "frame_00007.png", "frame_00008.png", "frame_00009.png", "frame_00010.png", "frame_00011.png", "frame_00012.png", "frame_00013.png", "frame_00014.png", "frame_00015.png", "frame_00016.png"](cost)

or this:

cost := math.toInt((10 * (sim.time)) % 17);
cost > 9 ? {
texture = "frame_000" + cost + ".png"
} : {
texture = "frame_0000" + cost + ".png"
}
_________________________________________________­____
to reduce the actual amount of code in the scripts
of each torus, and you can see the shorter usage
of the mathematical modulus-function as a simple %

Thanks to you, s_noonan! :)
Last edited at 2016/01/01 10:20:30 by DrBalk
This is awesome because I can chop up the original geometry into little bits of polygons and each one still runs the animation (although they have to be resized).

Could you please explain how "cost" works in this script? I'm puzzled about it being at the end of the code like this: (cost)()
How does that work? Thanks!

cost := math.mod(math.toInt(10 * (sim.time)), 17);
[{
texture = "frame_00000.png"
}, {
texture = "frame_00001.png"
}, {
texture = "frame_00002.png"
}, {
texture = "frame_00003.png"
}, {
texture = "frame_00004.png"
}, {
texture = "frame_00005.png"
}, {
texture = "frame_00006.png"
}, {
texture = "frame_00007.png"
}, {
texture = "frame_00008.png"
}, {
texture = "frame_00009.png"
}, {
texture = "frame_00010.png"
}, {
texture = "frame_00011.png"
}, {
texture = "frame_00012.png"
}, {
texture = "frame_00013.png"
}, {
texture = "frame_00014.png"
}, {
texture = "frame_00015.png"
}, {
texture = "frame_00016.png"
}](cost)()
yes, Xray, the cutting and resizing of video-pieces is amazing! :)
In the forum
http://www.algodoo.com/forum/viewtopic.php?f=13&t=11002&p=80785&hilit=case#p80785
Kilinich showed that the code
[{code1},{code2},{code3}](index)()
selects the code1 if index=0,
and the code2 if index=1
and the code3 if index=2.
So with the first line
cost := math.mod(math.toInt(10 * (sim.time)), 17);
the number of the costume is selected, dependent on the sim.time.
It runs in integer-steps from 0,1,2,3,...,16 and this way selects
in the next line the code-selection in Kilinich's trick for
the case-structure in thyme.
How this precisely works, i dont know.
I assume, that this is done with pointers, which lead to adresses
of an array. I think that [A,B,C] is an array and
[A,B,C](0) is A, but i dont know the meaning of the second "()"
behind "index".
I think that Kilinich can answer to that, and may even cite the
description where he found this structure. Anyway, upto then i just
use it, and s_noonan's abbreviated version.;)
That helps a great deal. THANKS! :)