Animation with jQuery and HTML 5 — play sound, touch sensitive - audio

I have a circle I divided it into 16 parts (4 segments in each of 4 quarters) and name each part by numbers 1,2,2,2 / 1,2,2,2 / 1,2,2,2 / 1,2,2,2.
I want to write an HTML5 and jQuery code to animate outline stork of circle by clicking on yellow part (1 piece of 16 parts is yellow; the others are gray). The program starts animation from where the yellow part is. The code should animate numbers around circle by changing its color and at the same time play a sound with each number. For example, if the animation receives part 1, its color changes to orange and plays the sound "hello"; and if the animation receives number 2, it plays sound "welcome" and changes its color to orange.
After each quarter of the circle, I want to have a little delay. For example, after playing quarter 1, the program should stop playing for 50sc and then start quarter 2 and so on. At the end of the process, the yellow part animates with glow light and stops playing.

Related

mlt double tent fade in and fade out

Yesterday I saw the wonderfull screen transition effect of a samsung smartphone, where the fade out and fade in was not just all screen getting black and coming back, butthe black color is arriving troug h2 lateral "tents" that arriving are making the screen black and the opposite. How to do it with melt?
PS.
the tents are blur and not just black blocks coming to blacking all the screen.
MLT has a transitions module named "luma" that takes a grayscale image to define the reveal of the second image or clip. There are some examples in this video.
Most of those examples are hard edge, but there is also a softness parameter. As for the blur, you can attach a blur filter to either clips and/or the transition as well. In addition, the blurriness parameter can be animated over time.

PyQT: clearly displaying number on top of background

I'm trying to display a number on a board with lines (go game). Right now, the number is displayed on top of a cross, so it's not very easy to tell. See the screen shot below
The background is drawn with setBackgroundBrush() on the scene.
The lines are QGraphicsLineItem which are added to the scene after the background.
I've tried to display a small portion of the background below the number but the effect isn't great. Is there a smart way of doing this so that when the number is displayed, the area that's covered by the number only shows the background texture and not the lines?

AndroidPlot - Position TextLabelWidget not consistently on different devices

I have a chart show info of apps, but when run it on devices android. The position of text on chart not consistently.
These images illustrate the problem: https://drive.google.com/folderview?id=0B7-CxJHQ5ZnjYjVlTlFQdElWRGM&usp=sharing
I use TextLabelWidget in AndroidPlot. How to keep position of TextLabelWidget on chart with the same image1 in link above on devices?
The problem appears to be that your plot area is set to fill the width of the screen and since the bars are evenly distributed in that space, their x positions are essentially fractions of the screen width.
At the same time you have labels that appear to be positioned using absolute positioning. As an example, this code will position 4 labels at 0%, 25%, 50% and 75% screen width, 80 pixels down from the top of the screen:
txtWidget1.position(0, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget2.position(0.25f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget3.position(0.50f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
txtWidget4.position(0.75f, XLayoutStyle.RELATIVE_TO_LEFT, PixelUtils.dpToPix(80), YLayoutStyle.ABSOLUTE_FROM_TOP, AnchorPosition.LEFT_TOP);
There are some other factors that you are also probably going to need to deal with such as bar width but this should get you closer. You may find this doc useful as far as a guide for the different positioning methods.
Another tool to consider using if you aren't using it already is the Configurator. This will let you set your positions etc. inside xml and override values based on screen size, orientation, etc.

How computers draw transparency?

In real life, transparency (or opacity) can be explained in a "simple" way by how much an object can reflect light, or how much of it pass through. So if an object is transparent light pass trough it, reflect on whatever is behind it and the light get back to us.
How computers simulate this behavior? I mean, we as developers, have many abstractions and APIs to set alpha levels and opacities of our pixels but how computers translates this into a bitmap to the screen?
What I think is happening: Both back and front colors are "combined" to result in a third color and this is then draw to screen. Eg: transparent white over back red on screen will be painted as pink!
Yes, you have it right. The "back" color is combined with the "front" color in proportion to the opacity of the front color.
For a single color channel, e.g. red, with opacity from 0 to 1:
new = old * (1 - opacity) + front * opacity

Animating UIButton alpha with a PNG background: why does the animation get bright white as it transitions from alpha = 0 to alpha = 1?

This is something that is stumping me; I have a simple UIButton with the following PNG as it's background:
I'm using an iOS 4 block animation, and all I'm doing is animating it's alpha property from 0.0 to 1.0. However, while the animation is in progress, the UIButton gets bright white, before finally settling to look like the above image when the property reaches 1.0.
I'm pretty stumped - if, for example, I open that image in Paint.NET and slide the image's opacity from 0 to 255, I see a nice fade-in effect - which is exactly what I'm going for. But when I animate an opacity change in iOS, the button gets bright white during the middle part of the animation.
If I change the animation's duration to something extended, like 5 seconds, the effect is even more prominent. Any ideas?
Edit: I am using Xcode 4.1, and running iOS 4.3.3 (first gen iPad).
It turns out, after much consideration, that the issue was my UIButton was a Round Rect button; the type needed to be changed to Custom. Even though the background images I set for my button worked when the type was Round Rect, applying an alpha animation to the button still caused the default white Round Rect style to appear for the duration of the animation. That is what my eyes interpreted as "bright white" during the animation - it had nothing to do with my PNG background, and everything to do with the underlying type of the button I was using.
Problem solved. Moral of the story? Change your UIButton type to Custom if you're going to animate the button while using your own background images.

Resources