Skip to content

Instantly share code, notes, and snippets.

@branflake2267
Last active January 6, 2017 00:10
Show Gist options
  • Save branflake2267/b250e1d6b2b43a1535d25146cbb4980a to your computer and use it in GitHub Desktop.
Save branflake2267/b250e1d6b2b43a1535d25146cbb4980a to your computer and use it in GitHub Desktop.
GWT CSS3 Marquee Animation.
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
public interface ApplicationResources extends ClientBundle {
public ApplicationResources INSTANCE = GWT.create(ApplicationResources.class);
public interface AppStyles extends CssResource {
String marquee();
}
@Source("styles.gss")
public AppStyles styles();
}
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
public class HtmlAnimationTest implements EntryPoint {
@Override
public void onModuleLoad() {
// only do once
ApplicationResources.INSTANCE.styles().ensureInjected();
HTML html = new HTML("<span>The fox jumped over the moon. The chicken crossed the road.</span>");
// css3 to html
html.setStyleName(ApplicationResources.INSTANCE.styles().marquee());
RootPanel.get().add(html, 50, 50);
}
}
.marquee {
width: 150px;
margin: 0 auto;
white-space: nowrap;
overflow: hidden;
box-sizing: border-box;
border: 1px solid gray;
}
.marquee span {
display: inline-block;
padding-left: 100%;
animation: marquee 15s linear infinite;
}
.marquee span:hover {
animation-play-state: paused;
}
@keyframes marquee {
0% { transform: translate(0, 0); }
100% { transform: translate(-100%, 0); }
}
@branflake2267
Copy link
Author

Example:
html css3 marquee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment