I want to create a sprite animation (similar to an hourglass). I found no way to do that, but there are script commands f: animation_play. How can I use this to show multiple pictures in a row (like a slideshow)? What do I have to pass as a parameter?
I searched the manual of guide studio and found only the script function, but not how to use it.
You can show a slideshow (i.e. different images) by using an animated property:
Add an image widget to the view (here: "View 1" where the animation shall be shown. Name the image Sprite.
Add two properties to the image widget:
Type Image list, name it e.g. sprite
Type Integer, name it e.g. spriteIdx
Add the images to the resources of the model
Add the images to the image list sprite
Add an Animation widget to the image and add an Animated property to it:
Select "View 1" (not Data pool)
Choose spriteIdx which is below Sprite
Define the properties for the the animated property:
start = 0
end = number of pictures (not -1)
set duration, repeat, alternating as desired
To start the animation, you need a script:
add a property of type conditional script to the image Sprite
script source could be:
function(v:arg0::bool)
{
if (!v:arg0)
{
f:trace_string("Play")
f:animation_play(v:this->"Animation 1")
}
false
}
the parameter of f:animation_play is the reference to the Animated property created in step 5
add a trigger event; alternatively you could e.g. start the animation when entering the state (with an entry action)
Related
I am developing a win32 application and I want to use my own images instead of default + and - signs in tree view.
I also found here that I can use images in four cases-
1)An image, such as an open folder, displayed when the item is selected.
2)An image, such as a closed folder, displayed when the item is not selected.
3)An overlay image that is drawn transparently over the selected or nonselected image.
4)A state image, which is an additional image displayed to the left of the selected or nonselected image. You can use state images, such as checked and cleared check boxes, to indicate application-defined item states.
I found some examples like this one(uses state images) but it seems it is not related to my query.
But I can't find how to replace default + and - signs of tree view with my images.
Please help me out of it. Thanks in advance.
The "expansion" buttons are not drawn using an assigned image list; instead they come from the current theme (or in XP/non-themed, are hard-coded glyphs).
The only way to customize them is to use Custom Draw and draw the tree items yourself.
I'm using easeljs in order to control my CANVAS.
And I'm trying to make animation by changing images, but not using spritesheet.
But whenever images are changed there is time lag( like blinking)...
How can I remove blinking not using spritesheet?
My guess (until you provide code), is that the image is being loaded during this gap, that's why you see a blink, and this is because you are loading the image in the same container (meaning the place where the image is loaded/displayed).
The solution to this is to use 2 containers, one in the top of the other; you have the first image loaded, and when you load the next image, you set a complete event on that second image, and when the second image loads, you remove the first one.
In the end you will have to create a class to manage both images and their events, this because if you are trying i.e. creating an image rotator, you will have to swap the bottom image loaded to the top, to make a smooth transition, and/or to add an alpha tween.
This is a very simple outline:
Container
topImage
bottomImage
this.addChild(topImage)
this.addChild(bottomImage)
bottomImage.on("complete", function(){
//add effect to top image (fade out)
//load image into top image
//fadein effect
})
topImage.on("complete", function(){
//first time you have to add an fade in
//but you can remove the event after that
})
this.load = function(path){
bottomImage.load(path)
}
I have created a symbol in Edge Animate, which contains a rectangle as view area and an image and text as contents of that view area. I want to set text and image src before I start the animation of the symbol. So when a certain area is clicked, I can set "Text" with
var thing = sym.getSymbol("mySymbol");
thing.$("Text").html("I can set some text here to change the content of Text.");
Question now is, how I can set the image source for the item "Image" within that symbol. I have looked into the files Edge Animate creates, and the text as shown above is in a field called "text", while the name of the image is contained with other information in a field called "fill". I don't have a clue how to set the image source. Any pointers?
Thanks in advance
M.
Here's a solid solution, which I've been working out over the past few hours.
General
The first step is to get a reference to the element, for example, if the element is named "MyTextBox", you would address it like this:
$(sym.lookupSelector("MyTextBox"));
Dynamically Changing Text
To do this, you can set the HTML property for the referenced element:
$(sym.lookupSelector("MyTextBox")).html("Hello World");
Dynamically Changing Images
Images are implemented by using the background-image CSS property of a DIV. If you had an image element named MyImageBox, the syntax would be:
$(sym.lookupSelector("MyImageBox")).css('background-image', [image]);
There's a second part, which is getting the [image] reference correct.
If it's in the default Edge images directory, use the relative URL:
images/MyNewImage.png
Use standard syntax for CSS background-image:
url(images/MyNewImage.png)
one approach might be to append an img tag and define its source.
for example:
$('<img src="mypic.png">').appendTo($('Text'));
replace "mypic.png" with the path for the image you want to use.
hope this helps.
I am having 4 images inside Canvas in HTML5. When I drop the image somewhere in the Canvas, I want to display the name of the image inside my Canvas .
Is it possible? If yes, please tell me how can it be done?
The source code can be found here. KineticJS is used to handle the canvas.
I've never used KineticJS before, but from what I read in the doc :
To detect drag and drop events with KineticJS, we can use the on() method to detect dragstart , dragmove, or dragend events. The on() method requires an event type and a function to be executed when the event occurs.
It'll end up beign something like this
rajiniGroup.on('dragend', function(evt) {
// add your text somewhere using a shape text
};
Shape text are detailed in the doc as well.
I am trying to implement image as checkbox.
I have a list with 2 columns and I want to display checbox image on right side, as a third column.On clicking that image ,the image will be changed to a different one.
In which way I can do this?
One way to do this would be to create a custom Field that extends BitmapField. This custom field could contain two Bitmap images (one for each state). You might even consider having four images, so that you can indicate when it has focus as well. For example: unchecked-non-focused, unchecked-focused, checked-non-focused, checked-focused.
When you want to change the image (i.e. on a touch event or trackball click) just have your custom Field call setBitmap() with the appropriate bitmap.