The Official Blog of Patcoola

Im just a dude watching over my parents,
and trying to make cartoons and video games from home.

Script: Tween Height To [JS Class]

Important!

Dear visitors,

This blog and the Tigarus.com network will be changing our website software in May (2024). There will be some down time and there will be a change to the webpage addresses.

We will also be removing the Anime blogs. The Rocksmith Songs website will be unavailable of a few weeks or months while I move the database to the new software.

At the moment we are running on Wordpress, the new software is an in-house project which is 57 times faster. It will also provide more freedom for development.

Thank you for understanding.

, By Patcoola

Script Title: tweenHeightTo
Programming Language: Java Script
Date Completed: 2013/04/07

Purpose: To animate the changing height of an HTML Element.

Advertisement

Donate Now!

Hi there, I spend a lot of time making this blog.

It would be great if you would consider donating.


Description: Changes the height of an HTML Element by animating the height change. Note: method will not start if the targetId or targetSize is not set or the input is not valid.

Methods:

var class = new tweenHeightTo();

class.targetId

Set to select a HTML Element by ID to be sized. *Required

class.targetSize

Set the amount of the new height measured in pixels. Takes a number value. *Required

class.pixelRate

Set the amount of pixels to change the size of the element each interval. Takes a positive or negative number. Determines whether to make larger or smaller. Default value 5.

class.intervals

Set the interval rate measured in milliseconds. Default value 16.

class.start()

Function to start the resizing animation.

class.stop()

Function to stop the resizing animation, sets the element size to the target size.

class.pause()

Function to pause the resizing animation.

class.isActive()

Function to determine if the resizing animation is active. Returns true or false.

Example Usage:

var sizeBox1 = new tweenHeightTo();

sizeBox1.targetId = “box”;
sizeBox1.targetSize = 60;
sizeBox1.pixelRate = -5;
sizeBox1.intervals = 8;
sizeBox1.start();

This example decreases the size of element ID box to the size of 60 by 5 pixels every 8 milliseconds (125 frames per second)

 

Advertisement

Donate Now!

After a hard day, I like to relax with a cold jar of pickle juice and a hardy fart. If you like my blog, please consider donating.


 

Post Meta

Share Post

 

Comments: Write Comment

Be the first to write a comment.


Leave a Comment


All comments are reviewed before publishing. Comments must be related to the page topic, must not be spam, and must comply with the criminal code of Canada.