Animating wave motion in waterObtaining a 3D animation as a drop in a liquid surfaceAnimating mathematica.se logoAnimating arrowsAnimating labelsHow to animate a propagating wave?Animating Boundary ElementsImporting and animating imagesNot getting smooth motion when animating a 3D plot (with jumps in rotation)Animating with changeable parametersAnimating a mechanical armAnimating point
Should a narrator ever describe things based on a characters view instead of fact?
Exit shell with shortcut (not typing exit) that closes session properly
What are the rules for concealing thieves' tools (or items in general)?
Is VPN a layer 3 concept?
Hackerrank All Women's Codesprint 2019: Name the Product
Have the tides ever turned twice on any open problem?
DisplayForm problem with pi in FractionBox
When should a starting writer get his own webpage?
Why is indicated airspeed rather than ground speed used during the takeoff roll?
The English Debate
"Marked down as someone wanting to sell shares." What does that mean?
Imaginary part of expression too difficult to calculate
label a part of commutative diagram
Why is "la Gestapo" feminine?
Why I don't get the wanted width of tcbox?
Animating wave motion in water
Turning a hard to access nut?
Do native speakers use "ultima" and "proxima" frequently in spoken English?
Single word to change groups
Hot air balloons as primitive bombers
Print a physical multiplication table
Recursively updating the MLE as new observations stream in
Nested Dynamic SOQL Query
Justification failure in beamer enumerate list
Animating wave motion in water
Obtaining a 3D animation as a drop in a liquid surfaceAnimating mathematica.se logoAnimating arrowsAnimating labelsHow to animate a propagating wave?Animating Boundary ElementsImporting and animating imagesNot getting smooth motion when animating a 3D plot (with jumps in rotation)Animating with changeable parametersAnimating a mechanical armAnimating point
$begingroup$
Further to this question I found on MSE, I tried to replicate
from here
this is as far as I got:
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
tab = With[a = #,
Flatten[Table[
Table[fun[a, 90 + 15 n, 1 - .15 m, -1 + .5 n, -.35 m], m, 0,
10], n, 0, 24], 1]] & /@ Range[1, 360, 15];
Module[t, x, y, fun, xf, yf, a, x = -.5; y = 1;
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
xf[t_, a_, b_] := a t - b Sin[t]; yf[t_, a_, b_] := a - b Cos[t];
Animate[
Show[
Graphics[
PointSize[.01], tab[[a]],
PlotRange -> -1 - x, 10 + x, -1 - y, 1
],
ParametricPlot[
(Pi/2) xf[t + 2 Pi a/24, 1.25, .6] - 4 Pi a/24 - Pi^2 + .05,
2.05 - 1.65 yf[t + 2 Pi a/24, 1.25, .6],
t, -4 Pi, 4 Pi, Axes -> False
]
],
a, 1, 24, 1, ControlPlacement -> Top, AnimationRate -> 5,
AnimationDirection -> Backward
]
]
which is not very efficient (I'm sure Part
could be applied more efficiently), and despite various tweeks, I couldn't quite manage to get the cycloid to line up with the points.
What is a better way to approach this?
performance-tuning animation
$endgroup$
add a comment |
$begingroup$
Further to this question I found on MSE, I tried to replicate
from here
this is as far as I got:
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
tab = With[a = #,
Flatten[Table[
Table[fun[a, 90 + 15 n, 1 - .15 m, -1 + .5 n, -.35 m], m, 0,
10], n, 0, 24], 1]] & /@ Range[1, 360, 15];
Module[t, x, y, fun, xf, yf, a, x = -.5; y = 1;
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
xf[t_, a_, b_] := a t - b Sin[t]; yf[t_, a_, b_] := a - b Cos[t];
Animate[
Show[
Graphics[
PointSize[.01], tab[[a]],
PlotRange -> -1 - x, 10 + x, -1 - y, 1
],
ParametricPlot[
(Pi/2) xf[t + 2 Pi a/24, 1.25, .6] - 4 Pi a/24 - Pi^2 + .05,
2.05 - 1.65 yf[t + 2 Pi a/24, 1.25, .6],
t, -4 Pi, 4 Pi, Axes -> False
]
],
a, 1, 24, 1, ControlPlacement -> Top, AnimationRate -> 5,
AnimationDirection -> Backward
]
]
which is not very efficient (I'm sure Part
could be applied more efficiently), and despite various tweeks, I couldn't quite manage to get the cycloid to line up with the points.
What is a better way to approach this?
performance-tuning animation
$endgroup$
$begingroup$
See this: mathematica.stackexchange.com/questions/123127/…
$endgroup$
– LCarvalho
14 hours ago
add a comment |
$begingroup$
Further to this question I found on MSE, I tried to replicate
from here
this is as far as I got:
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
tab = With[a = #,
Flatten[Table[
Table[fun[a, 90 + 15 n, 1 - .15 m, -1 + .5 n, -.35 m], m, 0,
10], n, 0, 24], 1]] & /@ Range[1, 360, 15];
Module[t, x, y, fun, xf, yf, a, x = -.5; y = 1;
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
xf[t_, a_, b_] := a t - b Sin[t]; yf[t_, a_, b_] := a - b Cos[t];
Animate[
Show[
Graphics[
PointSize[.01], tab[[a]],
PlotRange -> -1 - x, 10 + x, -1 - y, 1
],
ParametricPlot[
(Pi/2) xf[t + 2 Pi a/24, 1.25, .6] - 4 Pi a/24 - Pi^2 + .05,
2.05 - 1.65 yf[t + 2 Pi a/24, 1.25, .6],
t, -4 Pi, 4 Pi, Axes -> False
]
],
a, 1, 24, 1, ControlPlacement -> Top, AnimationRate -> 5,
AnimationDirection -> Backward
]
]
which is not very efficient (I'm sure Part
could be applied more efficiently), and despite various tweeks, I couldn't quite manage to get the cycloid to line up with the points.
What is a better way to approach this?
performance-tuning animation
$endgroup$
Further to this question I found on MSE, I tried to replicate
from here
this is as far as I got:
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
tab = With[a = #,
Flatten[Table[
Table[fun[a, 90 + 15 n, 1 - .15 m, -1 + .5 n, -.35 m], m, 0,
10], n, 0, 24], 1]] & /@ Range[1, 360, 15];
Module[t, x, y, fun, xf, yf, a, x = -.5; y = 1;
fun[a_, b_, c_, x_, y_] :=
Point[#[[1]] + x, #[[2]] + y &[
Part[CirclePoints[360] c,
If[a + b == 360, 360, Mod[a + b, 360]]]]];
xf[t_, a_, b_] := a t - b Sin[t]; yf[t_, a_, b_] := a - b Cos[t];
Animate[
Show[
Graphics[
PointSize[.01], tab[[a]],
PlotRange -> -1 - x, 10 + x, -1 - y, 1
],
ParametricPlot[
(Pi/2) xf[t + 2 Pi a/24, 1.25, .6] - 4 Pi a/24 - Pi^2 + .05,
2.05 - 1.65 yf[t + 2 Pi a/24, 1.25, .6],
t, -4 Pi, 4 Pi, Axes -> False
]
],
a, 1, 24, 1, ControlPlacement -> Top, AnimationRate -> 5,
AnimationDirection -> Backward
]
]
which is not very efficient (I'm sure Part
could be applied more efficiently), and despite various tweeks, I couldn't quite manage to get the cycloid to line up with the points.
What is a better way to approach this?
performance-tuning animation
performance-tuning animation
edited 12 hours ago
Kuba♦
106k12208530
106k12208530
asked 15 hours ago
martinmartin
3,98121248
3,98121248
$begingroup$
See this: mathematica.stackexchange.com/questions/123127/…
$endgroup$
– LCarvalho
14 hours ago
add a comment |
$begingroup$
See this: mathematica.stackexchange.com/questions/123127/…
$endgroup$
– LCarvalho
14 hours ago
$begingroup$
See this: mathematica.stackexchange.com/questions/123127/…
$endgroup$
– LCarvalho
14 hours ago
$begingroup$
See this: mathematica.stackexchange.com/questions/123127/…
$endgroup$
– LCarvalho
14 hours ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
DynamicModule[t = 0, d = 5, a = .08, base, distortion, pts, r, f, n = 10,
r[y_] := .08 y^4;
f[x_] := -2 Pi Dynamic[t] + d x;
(*f does not evaluate to a number but FE will take care of that later*)
base = Array[List, n 3, 1, 0, Pi, 0, 1 ];
distortion = Array[
Function[x, y, r[y] Cos @ f @ x, Sin @ f @ x], n 3, 1, 0, Pi, 0, 1
];
pts = base + distortion;
Row[
Animator[Dynamic @ t, AnimationRate -> .8, AppearanceElements -> ],
Graphics[
LightBlue,
Polygon @ Join[ pts[[;; , -1]], Scaled[1, 0], Scaled[0, 0]],
Darker @ Blue, AbsolutePointSize @ 5, Point @ Catenate @ pts,
AbsolutePointSize @ 7, Orange, Thick,
Point @ pts[[15, -1]], Circle[base[[15, -1]], r @ base[[15, -1, 2]]],
Point @ pts[[15, 7]], Circle[base[[15, 7]], r @ base[[15, 7, 2]]]
,
PlotRange -> 0 + .1, Pi - .1, 0, 1.2,
PlotRangePadding -> 0,
PlotRangeClipping -> True, ImageSize -> 800]
]
]
$endgroup$
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
);
);
, "mathjax-editing");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193480%2fanimating-wave-motion-in-water%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
DynamicModule[t = 0, d = 5, a = .08, base, distortion, pts, r, f, n = 10,
r[y_] := .08 y^4;
f[x_] := -2 Pi Dynamic[t] + d x;
(*f does not evaluate to a number but FE will take care of that later*)
base = Array[List, n 3, 1, 0, Pi, 0, 1 ];
distortion = Array[
Function[x, y, r[y] Cos @ f @ x, Sin @ f @ x], n 3, 1, 0, Pi, 0, 1
];
pts = base + distortion;
Row[
Animator[Dynamic @ t, AnimationRate -> .8, AppearanceElements -> ],
Graphics[
LightBlue,
Polygon @ Join[ pts[[;; , -1]], Scaled[1, 0], Scaled[0, 0]],
Darker @ Blue, AbsolutePointSize @ 5, Point @ Catenate @ pts,
AbsolutePointSize @ 7, Orange, Thick,
Point @ pts[[15, -1]], Circle[base[[15, -1]], r @ base[[15, -1, 2]]],
Point @ pts[[15, 7]], Circle[base[[15, 7]], r @ base[[15, 7, 2]]]
,
PlotRange -> 0 + .1, Pi - .1, 0, 1.2,
PlotRangePadding -> 0,
PlotRangeClipping -> True, ImageSize -> 800]
]
]
$endgroup$
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
add a comment |
$begingroup$
DynamicModule[t = 0, d = 5, a = .08, base, distortion, pts, r, f, n = 10,
r[y_] := .08 y^4;
f[x_] := -2 Pi Dynamic[t] + d x;
(*f does not evaluate to a number but FE will take care of that later*)
base = Array[List, n 3, 1, 0, Pi, 0, 1 ];
distortion = Array[
Function[x, y, r[y] Cos @ f @ x, Sin @ f @ x], n 3, 1, 0, Pi, 0, 1
];
pts = base + distortion;
Row[
Animator[Dynamic @ t, AnimationRate -> .8, AppearanceElements -> ],
Graphics[
LightBlue,
Polygon @ Join[ pts[[;; , -1]], Scaled[1, 0], Scaled[0, 0]],
Darker @ Blue, AbsolutePointSize @ 5, Point @ Catenate @ pts,
AbsolutePointSize @ 7, Orange, Thick,
Point @ pts[[15, -1]], Circle[base[[15, -1]], r @ base[[15, -1, 2]]],
Point @ pts[[15, 7]], Circle[base[[15, 7]], r @ base[[15, 7, 2]]]
,
PlotRange -> 0 + .1, Pi - .1, 0, 1.2,
PlotRangePadding -> 0,
PlotRangeClipping -> True, ImageSize -> 800]
]
]
$endgroup$
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
add a comment |
$begingroup$
DynamicModule[t = 0, d = 5, a = .08, base, distortion, pts, r, f, n = 10,
r[y_] := .08 y^4;
f[x_] := -2 Pi Dynamic[t] + d x;
(*f does not evaluate to a number but FE will take care of that later*)
base = Array[List, n 3, 1, 0, Pi, 0, 1 ];
distortion = Array[
Function[x, y, r[y] Cos @ f @ x, Sin @ f @ x], n 3, 1, 0, Pi, 0, 1
];
pts = base + distortion;
Row[
Animator[Dynamic @ t, AnimationRate -> .8, AppearanceElements -> ],
Graphics[
LightBlue,
Polygon @ Join[ pts[[;; , -1]], Scaled[1, 0], Scaled[0, 0]],
Darker @ Blue, AbsolutePointSize @ 5, Point @ Catenate @ pts,
AbsolutePointSize @ 7, Orange, Thick,
Point @ pts[[15, -1]], Circle[base[[15, -1]], r @ base[[15, -1, 2]]],
Point @ pts[[15, 7]], Circle[base[[15, 7]], r @ base[[15, 7, 2]]]
,
PlotRange -> 0 + .1, Pi - .1, 0, 1.2,
PlotRangePadding -> 0,
PlotRangeClipping -> True, ImageSize -> 800]
]
]
$endgroup$
DynamicModule[t = 0, d = 5, a = .08, base, distortion, pts, r, f, n = 10,
r[y_] := .08 y^4;
f[x_] := -2 Pi Dynamic[t] + d x;
(*f does not evaluate to a number but FE will take care of that later*)
base = Array[List, n 3, 1, 0, Pi, 0, 1 ];
distortion = Array[
Function[x, y, r[y] Cos @ f @ x, Sin @ f @ x], n 3, 1, 0, Pi, 0, 1
];
pts = base + distortion;
Row[
Animator[Dynamic @ t, AnimationRate -> .8, AppearanceElements -> ],
Graphics[
LightBlue,
Polygon @ Join[ pts[[;; , -1]], Scaled[1, 0], Scaled[0, 0]],
Darker @ Blue, AbsolutePointSize @ 5, Point @ Catenate @ pts,
AbsolutePointSize @ 7, Orange, Thick,
Point @ pts[[15, -1]], Circle[base[[15, -1]], r @ base[[15, -1, 2]]],
Point @ pts[[15, 7]], Circle[base[[15, 7]], r @ base[[15, 7, 2]]]
,
PlotRange -> 0 + .1, Pi - .1, 0, 1.2,
PlotRangePadding -> 0,
PlotRangeClipping -> True, ImageSize -> 800]
]
]
edited 4 hours ago
answered 12 hours ago
Kuba♦Kuba
106k12208530
106k12208530
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
add a comment |
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
$begingroup$
thanks - a vastly better approach!
$endgroup$
– martin
12 hours ago
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f193480%2fanimating-wave-motion-in-water%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
See this: mathematica.stackexchange.com/questions/123127/…
$endgroup$
– LCarvalho
14 hours ago