Reputation: 137
I created a hero banner with a background image and an SVG that makes a wave effect overlaying the image.
But I don't know how to invert this wave, I mean to change the sides of the valley and the peak of it.
<section class="herobanner"></section>
.herobanner {
height:100vh;
background:
url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 54 54" width="2000" ><path d="M0 48 C30 60 38 40 64 48 L64 64 L0 64 Z" fill="white" stroke="rgba(255,255,255,1)" stroke-width="2"/></svg>') bottom,
url('../images/bg/herobanner3.jpg') center/cover;
}
I tried changing some numbers in the svg path but I hadn't success.
Upvotes: 0
Views: 664
Reputation: 33044
In order to invert the wave you need to scale it. For example your svg is this:
svg{border:1px solid;transform:scale(-1,1)}
<svg viewBox="0 45 64 19" ><path d="M0 48 C30 60 38 40 64 48 L64 64 L0 64 Z" stroke="red" /></svg>
Alternatively, instead of css you may use presentational attributes:
<svg viewBox="0 45 64 20" ><path transform="scale(-1,1) translate(-64,0)" d="M0 48 C30 60 38 40 64 48 L64 64 L0 64 Z" stroke="red" /></svg>
Ans you can use this SVG element as a background:
.herobanner {
border:1px solid;
height:100vh;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 45 64 20'%3E%3Cpath transform='scale(-1,1) translate(-64,0)' d='M0 48 C30 60 38 40 64 48 L64 64 L0 64 Z' stroke='red' /%3E%3C/svg%3E");
background-repeat:no-repeat;
}
<section class="herobanner"></section>
Or you can transform the .herobanner
with CSS:
.herobanner {
border:1px solid;
height:100vh;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 45 64 20'%3E%3Cpath d='M0 48 C30 60 38 40 64 48 L64 64 L0 64 Z' stroke='red' /%3E%3C/svg%3E");
background-repeat:no-repeat;
transform:scale(-1,1)
}
<section class="herobanner"></section>
Upvotes: 3