本文整理汇总了Java中com.google.gwt.animation.client.Animation.run方法的典型用法代码示例。如果您正苦于以下问题:Java Animation.run方法的具体用法?Java Animation.run怎么用?Java Animation.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.animation.client.Animation
的用法示例。
在下文中一共展示了Animation.run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.google.gwt.animation.client.Animation; //导入方法依赖的package包/类
public static void show(String text, int delayMillis, final boolean doReload){
final PopupPanel notificationPopup = new PopupPanel(false);
final Label label = new Label(text);
notificationPopup.setWidget(label);
notificationPopup.setPopupPosition(50, 20);
notificationPopup.setVisible(true);
notificationPopup.show();
Timer t = new Timer() {
@Override
public void run() {
Animation a = new Animation() {
@Override
protected void onUpdate(double progress) {
notificationPopup.getElement().getStyle().setProperty("opacity", String.valueOf(1-progress));
if(progress == 1) {
notificationPopup.hide();
if(doReload)
Location.reload();
}
}
};
a.run(500);
}
};
t.schedule(delayMillis);
}
示例2: animate
import com.google.gwt.animation.client.Animation; //导入方法依赖的package包/类
@Override
public void animate() {
Animation a = new Animation() {
@Override
protected void onUpdate(double progress) {
Composite c = InfluenceAnswerTextView.this;
c.getElement().getStyle().setProperty("opacity", String.valueOf(progress));
}
};
a.run(3000);
}
示例3: animate
import com.google.gwt.animation.client.Animation; //导入方法依赖的package包/类
@Override
public void animate() {
Animation a = new Animation() {
@Override
protected void onUpdate(double progress) {
Composite c = InfluenceAnswerAudioView.this;
c.getElement().getStyle().setProperty("opacity", String.valueOf(progress));
}
};
a.run(3000);
}
示例4: animatedRedraw
import com.google.gwt.animation.client.Animation; //导入方法依赖的package包/类
/**
* Redraw the canvas with HTML5 animation
*
* @param old_width
* width of viewport in base coordinates before any zoom
* operations
* @param center
* optional (x, y) center coordinates. Coordinates are relative
* to the HTML5 canvas in the broswer.
*/
public void animatedRedraw(int old_width, int... center) {
CanvasElement canv = viewport_context.getCanvas();
int x = center.length == 2 ? center[0] : canv.getWidth() / 2;
int y = center.length == 2 ? center[1] : canv.getHeight() / 2;
Animation anim = new ZoomAnimation(viewport_context, canv, cb,
old_width, area.viewportBaseWidth(), x, y);
anim.run(400);
}
示例5: resizeCenterImage
import com.google.gwt.animation.client.Animation; //导入方法依赖的package包/类
/**
* Resizes the center image; either maximizes it or returns it to normal
* size. Also fades out the side images on maximize. Runs the animation if
* animations are enabled.
*
* @param maximize
* true if you want to maximize the center image; false to return
* it back to normal size
*/
private void resizeCenterImage(final boolean maximize) {
if (animationEnabled && !animationRunning) {
animationRunning = true;
/* Set initial and target values to center image */
final VImage centerImg = visibleImages[visibleImages.length / 2];
if (maximize) {
centerImg.initAnimation(currentWidth, 0);
centerImg.getElement().getStyle().setZIndex(1);
} else {
centerImg.initAnimation(
Math.round(centerImageWidth * currentWidth),
(int) Math.floor((1 - centerImageWidth) / 2
* currentWidth));
centerImg.getElement().getStyle().clearZIndex();
}
Animation animation = new Animation() {
private boolean continueMaximize = true;
private boolean startMinimize = false;
@Override
protected void onUpdate(double progress) {
if (animationRunning) {
for (VImage img : visibleImages) {
if (img != centerImg) {
updateOpacity(img, progress, maximize);
continue;
}
int newWidth = img.getStartWidth()
+ (int) Math.round((img.getEndWidth() - img
.getStartWidth()) * progress);
if (maximize && continueMaximize) {
updateAnimatedPositionAndWidth(img, progress);
continueMaximize = !(newWidth > img
.getImageAndMarginWidth());
}
startMinimize = newWidth < img
.getImageAndMarginWidth();
if (!maximize && startMinimize) {
updateAnimatedPositionAndWidth(img, progress);
}
}
if (progress >= 1) {
animationRunning = false;
renderImages();
}
}
}
};
animation.run(animationDuration);
} else {
renderImages();
}
}
示例6: updateVisibleState
import com.google.gwt.animation.client.Animation; //导入方法依赖的package包/类
private void updateVisibleState(final boolean skipAnimation) {
ScheduledCommand command = new ScheduledCommand() {
public void execute() {
final int targetLeft = (value ? 0 : -getUnvisiblePartWidth());
final Element parentElement = mainElement.getParentElement();
if (skipAnimation) {
parentElement.getStyle().setProperty(
Css3Propertynames.INSTANCE._transition(), "");
setStyleName(parentElement, CLASSNAME + "-off", !value);
mainElement.getStyle().setProperty("left",
targetLeft + "px");
} else {
Animation a = new Animation() {
@Override
protected void onUpdate(double progress) {
int currentLeft = getCurrentPosition();
int newLeft = (int) (currentLeft + (progress * (targetLeft - currentLeft)));
mainElement.getStyle().setProperty("left",
newLeft + "px");
}
@Override
protected void onComplete() {
mainElement.getStyle().setProperty("left",
targetLeft + "px");
};
};
a.run(ANIMATION_DURATION_MS);
float d = ANIMATION_DURATION_MS / 1000;
parentElement.getStyle().setProperty(
Css3Propertynames.INSTANCE._transition(),
"background " + d + "s");
setStyleName(parentElement, CLASSNAME + "-off", !value);
}
}
};
if (getUnvisiblePartWidth() == 0) {
// CSS not properly injected yet
Scheduler.get().scheduleDeferred(command);
} else {
command.execute();
}
}