It is currently April 20th, 2024, 5:07 am

## Preserveaspectratio and scalemargins get the sliding effect

Skins that control functions in Windows or Rainmeter
Unight
Posts: 19
Joined: November 20th, 2012, 5:12 am

### Preserveaspectratio and scalemargins get the sliding effect

a small demo.

Code: Select all

``````[Rainmeter]
Update=40
MiddleMouseUpAction=!Refresh #CURRENTCONFIG#
DynamicWindowSize=1

Author=Unight
Name=Preserveaspectratio and scalemargins get the sliding effect
Version=1.0
Information=small and interesting demo

[Variables]
step=6
maxsize=191

[calc]
Measure=Calc
Formula=[calc]+#step#
DynamicVariables=1
IfAboveAction=[!SetOption "calc" "UpdateDivider" "-1" ][!SetOption "calc" "Formula" "#maxsize#"]
IfAboveValue=(#maxsize#-#step#)

[calcsin]
Measure=Calc
Formula=abs(sin(90/#maxsize#*[calc]*pi/180))*#maxsize#
DynamicVariables=1

[slideshow]
meter=image
imagename=demo.png
Preserveaspectratio=0
w=([calcsin])
h=377
x=1200
DynamicVariables=1
Scalemargins=0,0,[calcsin],0

``````
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

### Re: Preserveaspectratio and scalemargins get the sliding eff

Well done. :) The sine curve is a nice touch.

If you're planning to continue along these lines, here's something that might help you. It's a formula I worked out for transitioning any linear number value (X, Y, W, H, alpha, etc.) such that it accelerates at the beginning and decelerates at the end:

Code: Select all

``Xi + ((Xf - Xi) / 2) + ((Xf - Xi) / 2) * sin(pi * (t - 1/2))``
(Xi is the initial position constant, Xf is the final position constant, and t is the current point in the progression, between 0 and 1. By increasing or decreasing t at a constant rate, the formula evaluates the actual position over time.)