It is currently March 29th, 2024, 3:26 pm

Create 3D Flip Animation?

General topics related to Rainmeter.
Adrian0121
Posts: 15
Joined: March 9th, 2012, 11:29 am

Create 3D Flip Animation?

Post by Adrian0121 »

Hi all,

I'm wondering if it's possible to use Rainmeter to create a flipping animation for a meter. For example, I'd have a square meter that displays the weather. At first, it would display the picture of the weather (sun, clouds, rain, etc.) Then, on a MouseOverAction, it would 'flip' to show the other side which would show the degree value, like a page of a book. Is this possible? I've been reading about transformation matrices, but the furthest it gets is spinning a meter in 2D. Maybe there's a plugin I could use?

Thanks,
Adrian
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Create 3D Flip Animation?

Post by Brian »

Animation in general is not a good idea with Rainmeter. Some simple animations can be acheived, but they tend to use a lot of resources.

Technically, what you are asking could be accomplished with some clever coding with Transformation matrices and a smaller Update value (or Lua script), but again I would not go this route because of the resources that you will be using.

If you still want to pursue this, I suggest you read through the Transformation Matrix tips page. And user XANCI has made this template to demonstrate how skins can "rotate" in 3D. (Again, if you notice the Update value of that skin is 10, which is extremely high and will use a lot of resources).

-Brian
Adrian0121
Posts: 15
Joined: March 9th, 2012, 11:29 am

Re: Create 3D Flip Animation?

Post by Adrian0121 »

Duly noted.

Thanks!
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

Re: Create 3D Flip Animation?

Post by XANCI »

I don't think this will use much resources :)

FlipWeather.ini

Code: Select all

[Rainmeter]
Author=XANCI
Update=20
MouseOverAction=!CommandMeasure MeasureScript iT=9
MouseLeaveAction=!CommandMeasure MeasureScript iT=0
MouseActionCursor=0

[Variables]

[MeasureScript]
Measure=Script
ScriptFile="#CURRENTPATH#FlipWeather.lua"

[MeterB]
Meter=IMAGE
W=100
H=140
SolidColor=00000001
UpdateDivider=50

[MeterB1]
Group=1
Meter=IMAGE
Y=20
W=100
H=100
SolidColor=000000
AntiAlias=1
UpdateDivider=50

[MeterT1]
Group=1
Meter=STRING
X=50
Y=48
FontColor=FFFFFF
FontSize=24
StringAlign=CENTER
Text=SideA
AntiAlias=1
UpdateDivider=50

[MeterB2]
Group=2
Meter=IMAGE
Y=20
W=100
H=100
SolidColor=FFFFFF
AntiAlias=1
Hidden=1
UpdateDivider=50

[MeterT2]
Group=2
Meter=STRING
X=50
Y=48
FontColor=000000
FontSize=24
StringAlign=CENTER
Text=SideB
AntiAlias=1
Hidden=1
UpdateDivider=50
FlipWeather.lua

Code: Select all

function Initialize()
	iPH=-20*math.pi/180
	iXM=50
	iYM=70
	iM=-1
	iT=0
end

function Update()
	if iM<iT then
		iM=iM+1
		F()
	elseif iM>iT then
		iM=iM-1
		F()
	end
end

function F()
	iTH1=(iM*20)*math.pi/180
	iTH2=(iM*20+180)*math.pi/180
	iA1=math.cos(iTH1)
	iA2=math.cos(iTH2)
	iB1=math.sin(iTH1)*math.sin(iPH)
	iB2=math.sin(iTH2)*math.sin(iPH)
	iC=0
	iD=math.cos(iPH)
	iE1=iXM*(1-math.cos(iTH1))
	iE2=iXM*(1-math.cos(iTH2))
	iF1=iYM*(1-math.cos(iPH))-iXM*math.sin(iTH1)*math.sin(iPH)
	iF2=iYM*(1-math.cos(iPH))-iXM*math.sin(iTH2)*math.sin(iPH)
	SKIN:Bang("!SetOption MeterB1 TransformationMatrix "..iA1..";"..iB1..";"..iC..";"..iD..";"..iE1..";"..iF1)
	SKIN:Bang("!SetOption MeterT1 TransformationMatrix "..iA1..";"..iB1..";"..iC..";"..iD..";"..iE1..";"..iF1)
	SKIN:Bang("!SetOption MeterB2 TransformationMatrix "..iA2..";"..iB2..";"..iC..";"..iD..";"..iE2..";"..iF2)
	SKIN:Bang("!SetOption MeterT2 TransformationMatrix "..iA2..";"..iB2..";"..iC..";"..iD..";"..iE2..";"..iF2)
	if (iM==4)and(iT<iM) then
		SKIN:Bang("!ShowMeterGroup 1")
		SKIN:Bang("!HideMeterGroup 2")
	elseif (iM==5)and(iT>iM) then
		SKIN:Bang("!ShowMeterGroup 2")
		SKIN:Bang("!HideMeterGroup 1")
	end
	SKIN:Bang("!UpdateMeterGroup 1")
	SKIN:Bang("!UpdateMeterGroup 2")
	SKIN:Bang("!Redraw")
end
Just mess it with your own measures & meters
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Create 3D Flip Animation?

Post by Brian »

XANCI wrote:I don't think this will use much resources :)
I guess I should elaborate on my previous post.

What I meant was that simple animations can be done, but the more complex the animation and/or the more meters that are changing, then the more resources will be used to "move" those meters around. If it stays simple, then there is little problem (BTW - thanks for adding the UpdateDivider in your example, which greatly reduced the resources used in this example).

Another thing to remember is that some people use dated computers, so using the "low update/transformation matrix" method could eat up resources that they do not have (not that it matters if the skin is for yourself and not distribution).

Hopefully one day there will be animation support for Rainmeter, but until then try to keep it simple.

-Brian
User avatar
fragrant.monkey
Posts: 51
Joined: September 18th, 2010, 1:03 am

Re: Create 3D Flip Animation?

Post by fragrant.monkey »

oddly... I tested this and it will crash RM on mouseover of the skin... tried several times. Copied exactly as given... :confused:

RM latest beta
Win7 32
fragrant.monkey :: deviantArt: aka snuffleupagus | coding: ThemeSaver for RocketDock | musician: Madera Dulce
User avatar
achfighter
Posts: 4
Joined: November 11th, 2012, 7:18 pm

Re: Create 3D Flip Animation?

Post by achfighter »

You can use any png type images for animations. You can create clickable and hidden animations. and I made a few skin like that.

If you want to rotate or animate any 3D model, just animate it and export just needed frames. Then you have perfect animated png frames looks like 3D. Dont remember, if you use many image sequence meters, It will use more system resources in some old computers.

Also you can use complex bounds between different config files for "click on skin hide, then show others" bangs.

I can't tell what I want to say excatly, I think. : ) watch this :

[youtube]http://www.youtube.com/watch?v=w9CgCtsx9KU[/youtube]

http://achfighter.deviantart.com